﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using SES.CMS.BL;
using SES.CMS.DO;
using System.Web.UI.HtmlControls;

namespace SES.CMS
{
    public partial class dangviet : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string host = Request.Url.Host;
                if (host.ToLower().Equals("localhost") || host.ToLower().Equals("cayxanhdangviet.com"))
                {
         //           hplLogoFooter.ToolTip = hplDefault.ToolTip = Ultility.WebTitle(true);
         //           ltrFooter.Text = new sysConfigBL().Select(new sysConfigDO { ConfigID = 11 }).ConfigValue;
                    Page.Title = Ultility.WebTitle(true);
                    imgLogo.ToolTip = Ultility.WebTitle(true);
                    imgLogo.ImageUrl = "/Media/dang-viet-logo.jpg";
         //           imgFooter.ImageUrl = imgLogo.ImageUrl = "/Media/dang-viet-logo.jpg";
                    ltrSlogan.Text = new sysConfigBL().Select(new sysConfigDO { ConfigID = 20 }).ConfigValue;
                }
                else
                {
          //          ltrFooter.Text = new sysConfigBL().Select(new sysConfigDO { ConfigID = 21 }).ConfigValue;
            //        hplLogoFooter.ToolTip = hplDefault.ToolTip = Ultility.WebTitle(false);
                    Page.Title = Ultility.WebTitle(false);
                    imgLogo.ToolTip = Ultility.WebTitle(false);
              //      imgFooter.ImageUrl = imgLogo.ImageUrl = "/Media/logo.jpg";
                    ltrSlogan.Text = new sysConfigBL().Select(new sysConfigDO { ConfigID = 24 }).ConfigValue;
                    imgLogo.ImageUrl = "/Media/dang-viet-logo.jpg";
                }

                HtmlMeta meta = new HtmlMeta();
                meta.Name = "description";
                meta.Content = new sysConfigBL().Select(new sysConfigDO() { ConfigID = 5 }).ConfigValue;
                Page.Header.Controls.Add(meta);
                string url = Request.Url.AbsolutePath;
                url = url.Substring(1, url.Length - 1);
                string url1 = url.Replace(".", "/");
                string Module = url1.Substring(0, url1.IndexOf("/"));
                if (Module.ToLower().Equals("about") || Module.ToLower().Equals("contact") || Module.ToLower().Equals("category") || Module.ToLower().Equals("article") || Module.ToLower().Equals("albums") || Module.ToLower().Equals("albumdetail"))
                {
                    ucLeftMenu1.Visible = false;
                    ucCategoryMenu1.Visible = true;
                }
            }
        }
        protected void imgbtnSearch_Click(object sender, EventArgs e)
        {
            string sp = "";
            if (rdSanPham.Checked)
                sp = "sp";
            if (rdTinTuc.Checked)
                sp = "tt";
            if (!txtSearch.Text.Equals(""))
            {
                Response.Redirect("/Search-" + sp + "/" + txtSearch.Text.Trim() + "/default.aspx");
            }
        }
    }
}